package com.hyg.lib_music.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.hyg.lib_music.R;

import me.drakeet.multitype.ItemViewBinder;

public class MusicCountViewBinder extends ItemViewBinder<String, MusicCountViewBinder.ViewHolder> {

    @Override
    protected @NonNull
    ViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) {
        View view = inflater.inflate(R.layout.item_music_child_head, parent, false);
        return new ViewHolder(view);
    }


    @Override
    protected void onBindViewHolder(@NonNull ViewHolder holder, @NonNull String count) {
        holder.setData(count);
    }


    class ViewHolder extends RecyclerView.ViewHolder {
        private @NonNull
        TextView status;
        private @NonNull
        TextView favoriteAll;

        ViewHolder(@NonNull View itemView) {
            super(itemView);

            status = itemView.findViewById(R.id.tv_status);
            favoriteAll = itemView.findViewById(R.id.tv_favorite_all);
        }

        void setData(@NonNull final String count) {
            status.setText("总"+ count + "首");
            favoriteAll.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                }
            });
        }
    }
}
